package com.jzo2o.customer.controller.operation;

import cn.hutool.core.bean.BeanUtil;
import com.jzo2o.common.model.PageResult;
import com.jzo2o.customer.mapper.AgencyCertificationMapper;
import com.jzo2o.customer.model.domain.AgencyCertification;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.response.AgencyCertificationAuditResDTO;
import com.jzo2o.customer.model.dto.response.AgencyCertificationResDTO;
import com.jzo2o.customer.model.dto.response.WorkerCertificationAuditResDTO;
import com.jzo2o.customer.service.IAgencyCertificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author itcast
 */
@RestController("operationAgencyCertificationController")
@RequestMapping("/operation")
@Api(tags = "运营端 - 机构认证信息相关接口")
public class AgencyCertificationController {

    @Resource
    private IAgencyCertificationService agencyCertificationService;



    @GetMapping("/agency-certification/{id}")
    @ApiOperation("根据机构id查询认证信息")
    public AgencyCertificationResDTO queryById(@PathVariable("id") Long id) {
        return BeanUtil.toBean(agencyCertificationService.getById(id), AgencyCertificationResDTO.class);
    }

    /**
     * 分页查询服务人员认证信息
     * @param pageQueryReqDTO
     * @
     */
    @GetMapping("/agency-certification-audit/page")
    public PageResult<AgencyCertificationAuditResDTO> page(AgencyCertificationAuditPageQueryReqDTO pageQueryReqDTO) {
        return agencyCertificationService.selectByPage(pageQueryReqDTO);
    }

    /**
     * 更新状态
     * @param id
     * @param
     */
    @PutMapping("/agency-certification-audit/audit/{id}")
    public void audit(@PathVariable("id") Long id, @RequestBody AgencyCertificationAuditResDTO agencyCertificationResDTO) {
        agencyCertificationService.updateRecording(id,agencyCertificationResDTO);
    }


}
